home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / DeskBus.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  5.2 KB  |  164 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        DeskBus.a
  3. ;
  4. ;    Contains:    Apple Desktop Bus (ADB) Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1987-1997 by Apple Computer, Inc., all rights reserved
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__DESKBUS__') = 'UNDEFINED' THEN
  19. __DESKBUS__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
  25.     include 'MixedMode.a'
  26.     ENDIF
  27.  
  28. ; typedef SInt8                         ADBAddress
  29.  
  30. ;    TempADBServiceRoutineUPP is needed because of circular definition of
  31. ;    ADBServiceRoutineProcPtr and ADBServiceRoutineUpp depending on each other.
  32. ;
  33.  
  34. ; typedef ProcPtr                         TempADBServiceRoutineUPP
  35.  
  36. ;    typedef pascal void (*ADBInitProcPtr)(SInt8 callOrder);
  37. ;
  38. ;    Note: ADBInitProcPtr can only be created in 68K assembly language 
  39. ;          since it is a head patch that must JUMP to the previous address
  40. ;
  41.  
  42. ADBDataBlock            RECORD 0
  43. devType                     ds.b    1                ; offset: $0 (0)        ;  original handler ID 
  44. origADBAddr                 ds.b    1                ; offset: $1 (1)        ;  original ADB Address 
  45. dbServiceRtPtr             ds.l    1                ; offset: $2 (2)        ;  service routine pointer 
  46. dbDataAreaAddr             ds.l    1                ; offset: $6 (6)        ;  this field is passed as the refCon parameter to the service routine 
  47. sizeof                     EQU *                    ; size:   $A (10)
  48.                         ENDR
  49. ; typedef struct ADBDataBlock *            ADBDBlkPtr
  50.  
  51. ADBSetInfoBlock            RECORD 0
  52. siService                 ds.l    1                ; offset: $0 (0)        ;  service routine pointer 
  53. siDataAreaAddr             ds.l    1                ; offset: $4 (4)        ;  this field is passed as the refCon parameter to the service routine 
  54. sizeof                     EQU *                    ; size:   $8 (8)
  55.                         ENDR
  56. ; typedef struct ADBSetInfoBlock *        ADBSInfoPtr
  57.  
  58. ;  ADBOpBlock is only used when calling ADBOp from 68k assembly code 
  59. ADBOpBlock                RECORD 0
  60. dataBuffPtr                 ds.l    1                ; offset: $0 (0)        ;  buffer: pointer to variable length data buffer 
  61. opServiceRtPtr             ds.l    1                ; offset: $4 (4)        ;  completionProc: completion routine pointer 
  62. opDataAreaPtr             ds.l    1                ; offset: $8 (8)        ;  refCon: this field is passed as the refCon parameter to the completion routine 
  63. sizeof                     EQU *                    ; size:   $C (12)
  64.                         ENDR
  65. ; typedef struct ADBOpBlock *            ADBOpBPtr
  66.  
  67. ;
  68. ; pascal void ADBReInit(void )
  69. ;
  70.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  71.         _ADBReInit:    OPWORD    $A07B
  72.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  73.         IMPORT_CFM_FUNCTION ADBReInit
  74.     ENDIF
  75.  
  76. ;    ADBOp has a different interface for 68k assembly than for everything else
  77. ;    for 68k assembly the interface is 
  78. ;    #pragma parameter __D0 ADBOp(__A0,__D0)
  79. ;    OSErr ADBOp( ADBOpBlock * pb, short commandNum );
  80. ;
  81.  
  82. ;    IMPORTANT NOTE:
  83. ;    "Inside Macintosh: Devices" documents the completion routine for ADBOp will be called with
  84. ;    four parameters using 68k register based calling conventions, specifically the completion routine
  85. ;    passed in should be of type ADBServiceRoutineProcPtr. However, when upp types were first added
  86. ;    to this interface file, the type ADBCompletionUPP was mistakenly used for the second parameter
  87. ;    to ADBOp. Since applications have shipped using completion routines of type ADBCompletionUPP,
  88. ;    the mistake cannot be corrected.
  89. ;    The only difference between ADBServiceRoutineUPP and ADBCompletionUPP is the former takes an extra
  90. ;    argument which is a pointer to itself, fortunately not needed for PowerPC code.
  91. ;    For compatibility with existing 68k code, when an ADBOp completion routine is called,
  92. ;    68k register A1 will point to the completion routine, as documented in Inside Mac.
  93. ;
  94.  
  95. ;
  96. ; pascal OSErr ADBOp(Ptr refCon, ADBCompletionUPP compRout, Ptr buffer, short commandNum)
  97. ;
  98.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  99.         _ADBOp:    OPWORD    $A07C
  100.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  101.         IMPORT_CFM_FUNCTION ADBOp
  102.     ENDIF
  103.  
  104. ;
  105. ; pascal short CountADBs(void )
  106. ;
  107.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  108.         ; returns:
  109.         ;    short           <= D0
  110.         _CountADBs:    OPWORD    $A077
  111.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  112.         IMPORT_CFM_FUNCTION CountADBs
  113.     ENDIF
  114.  
  115. ;
  116. ; pascal ADBAddress GetIndADB(ADBDataBlock *info, short devTableIndex)
  117. ;
  118.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  119.         ; parameters:
  120.         ;    info            => A0
  121.         ;    devTableIndex   => D0
  122.         ; returns:
  123.         ;    ADBAddress      <= D0
  124.         _GetIndADB:    OPWORD    $A078
  125.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  126.         IMPORT_CFM_FUNCTION GetIndADB
  127.     ENDIF
  128.  
  129. ;
  130. ; pascal OSErr GetADBInfo(ADBDataBlock *info, ADBAddress adbAddr)
  131. ;
  132.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  133.         ; parameters:
  134.         ;    info            => A0
  135.         ;    adbAddr         => D0
  136.         ; returns:
  137.         ;    OSErr           <= D0
  138.         _GetADBInfo:    OPWORD    $A079
  139.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  140.         IMPORT_CFM_FUNCTION GetADBInfo
  141.     ENDIF
  142.  
  143. ;
  144. ; pascal OSErr SetADBInfo(const ADBSetInfoBlock *info, ADBAddress adbAddr)
  145. ;
  146.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  147.         ; parameters:
  148.         ;    info            => A0
  149.         ;    adbAddr         => D0
  150.         ; returns:
  151.         ;    OSErr           <= D0
  152.         _SetADBInfo:    OPWORD    $A07A
  153.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  154.         IMPORT_CFM_FUNCTION SetADBInfo
  155.     ENDIF
  156.  
  157.  
  158.     ENDIF ; __DESKBUS__ 
  159.  
  160.